public class ThreadDemo8 {
    public static void main(String[] args) {
//serTian();
        doubleser();
    }
    public static void serTian(){
        long a=0;
        long b=0;
        long start=System.currentTimeMillis();
        for (long i = 0; i <100_0000_0000L ; i++) {
            a++;
        }
        for (long i = 0; i <100_0000_0000L ; i++) {
            b++;
        }
        long end=System.currentTimeMillis();
        System.out.println(end-start);


    }

    public static void doubleser(){
    long start=System.currentTimeMillis();
        Thread t1=new Thread(()->{
            long a=0;
            for(long i=0;i<100_0000_0000L;i++){
                a++;
            }
        });
        Thread t2=new Thread(()->{
            long b=0;
            for(long i=0;i<100_0000_0000L;i++){
                b++;
            }
        });
        try {
            t1.join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        try {
            t2.join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        long end=System.currentTimeMillis();
        System.out.println(end-start);
    }
}

